package com.jason.concurrent.callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @Author  yslai
 * @Date  2022/9/19 15:51
 * @Description 测试实现callable接口 实现多线程的操作
 */


class ThreadCa{

}
public class ThreadCall {


    public static void main(String[] args) {


        FutureTask<Integer> task = new FutureTask<>(()->{
            System.out.println(Thread.currentThread().getName()+"::");
            return 2024;
        });

        new Thread(task,"ss").start();

        try {
            System.out.println(task.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }

        System.out.println("mainover"+Thread.currentThread().getName());
    }
}
